# 转义运行时标签
RtInt = int
RtFloat = float
RtBool = bool
RtNone = None
RtStr = str
RtArray = list

RtTypes = (RtInt, RtFloat, RtBool, RtStr, RtArray, RtNone)


class OrType:
    def __init__(self, *args, **kwargs):
        self.reference_count: RtInt = 0
        self.size: RtInt = 8

    # 对象协议
    tp_name = 'type'
    tp_base_size = 0
    tp_item_size = 0
    tp_doc = ''

    tp_alloc = None
    tp_dealloc = None
    tp_print = None
    tp_repr = None
    tp_str = None
    tp_hash = None

    tp_new = None
    tp_subclass = None
    tp_base = None
    tp_mro = None

    tp_init = None
    tp_del = None
    tp_get_attribute = None
    tp_set_attribute = None

    # 调用协议
    tp_call = None

    # 数值协议
    nb_negative = None
    nb_positive = None

    nb_absolute = None
    nb_bool = None
    nb_string = None
    nb_integer = None
    nb_float = None

    nb_add = None
    nb_subtract = None
    nb_multiply = None
    nb_divide = None
    nb_floor_divide = None
    nb_true_divide = None
    nb_mod = None
    nb_div_mod = None
    nb_power = None
    nb_matrix_multiply = None

    nb_and = None
    nb_xor = None
    nb_or = None
    nb_invert = None
    nb_lshift = None
    nb_rshift = None

    nb_lt = None
    nb_le = None
    nb_eq = None
    nb_ne = None
    nb_gt = None
    nb_ge = None

    nb_inplace_add = None
    nb_inplace_sub = None
    nb_inplace_mul = None
    nb_inplace_div = None
    nb_inplace_floor_div = None
    nb_inplace_true_div = None
    nb_inplace_mod = None
    nb_inplace_power = None
    nb_inplace_lshift = None
    nb_inplace_rshift = None
    nb_inplace_invert = None
    nb_inplace_and = None
    nb_inplace_xor = None
    nb_inplace_or = None
    nb_inplace_matrix_multiply = None

    # 序列协议
    sq_length = None
    sq_concat = None
    sq_repeat = None
    sq_index = None
    sq_get_item = None
    sq_set_item = None
    sq_del_item = None
    sq_get_slice = None
    sq_set_slice = None
    sq_del_slice = None
    sq_contains = None
    sq_inplace_concat = None
    sq_inplace_repeat = None

    # 映射协议
    mp_check = None
    mp_length = None
    mp_has_key = None
    mp_get_item = None
    mp_set_item = None
    mp_del_item = None
    mp_keys = None
    mp_values = None
    mp_items = None

    # 迭代协议
    tp_iter = None
    tp_iternext = None

    # 缓冲区协议
    bf_get_buffer = None
    bf_release_buffer = None


RtType = OrType()
